//
//  LocationManager.h
//  Trackit
//
//  Created by yaodaobin on 2017/4/12.
//  Copyright © 2017年 yaodaobin. All rights reserved.
//

#import <Foundation/Foundation.h>


#import <CoreLocation/CoreLocation.h>
@class LocationInfo;
//设备GPS返回的location对象
typedef void (^LocationBlock)(LocationInfo *locationInfo);
//定位失败，或没拒绝定位
typedef void (^LocationErrorBlock) (NSError *error);

//定位失败，API 出错
typedef void (^LocationNativeAPiErrorBlock) (NSError *error);

@interface LocationManager : NSObject<CLLocationManagerDelegate>

@property (nonatomic,strong) CLLocationManager *locationManager;
@property (nonatomic,assign) int locationTime;
@property (nonatomic,assign) BOOL servicesEnabled;
@property (nonatomic,strong) LocationInfo *lacationInfo;
@property (nonatomic,copy)LocationNativeAPiErrorBlock locationNativeAPiErrorBlock;

+ (LocationManager *)shareLocation;
- (BOOL)locationServicesEnabled;
- (void) getLocationCoordinate:(LocationBlock) locaiontBlock
                         error:(LocationErrorBlock) errorBlock;

@end

@interface LocationInfo : NSObject
@property (nonatomic, strong) NSString *country;
@property (nonatomic, strong) NSString *province;
@property (nonatomic, strong) NSString *city;
@property (nonatomic, strong) NSString *county;
@property (nonatomic, strong) NSString *address;
@property (nonatomic, assign) CLLocationCoordinate2D coordinate;

- (void)updateWithLocationDic:(NSDictionary *)locationDic;

@end
